<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>ci3 admin—后台管理系统 - 登录</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" content="-">
<meta name="description" content="-">
<link rel="stylesheet" type="text/css" href="{{$public}}/css/login.min.css">
<style type="text/css">
.disabled-btn{background:#eee;}
.disabled-btn:hover{background-color:#eee;}
</style>
</head>
<body>
<div class="bg-wrap">
    <div id="form" class="main-cont-wrap login-model">
        <div class="form-title g-mb40">
            <span class="s-txt-c s-fs20">登录</span>
        </div>
        <div class="ui-form-item g-mb30">
            <span class="ui-form-txt">账号</span>
            <input type="text" name="email" class="ui-form-input" placeholder="请输入邮箱" required="" msg="邮箱不许为空">
        </div>
        <div class="ui-form-item g-mb30">
            <span class="ui-form-txt">登录密码</span>
            <input type="password" name="password" class="ui-form-input" placeholder="请输入密码" required="" msg="密码不许为空">
        </div>
        <!--验证码-->
        <div class="ui-form-item g-mb20">
            <span class="ui-form-txt">验证码</span>
            <input type="text" name="yzm" class="ui-form-input" placeholder="验证码" required="" msg="验证码不许为空" size="4" style="position: absolute;bottom: 8px">
            <img class="yzm-reload" title="点击刷新" src="{{$module}}/login/captcha" align="absbottom" onclick="this.src='{{$module}}/login/captcha?'+Math.random();" style="position: relative;left: 113px;bottom: 1px"></img>
        </div>
       
        <div class="ui-form-btn">

            <button type="submit" class="ui-button login-btn" >登 录</button>
        </div>

    </div>
</div>
<div class="footer-wrap">
    <p class="s-tac s-txt-gy1">&copy; 2016-2017 ci3-admin</p>
</div>
<script src="{{$public}}/js/jquery.min.js"></script>
<script src="{{$public}}/layer/layer.js"></script>
<script src="{{$public}}/js/server/ajax.common.js"></script>
<script src="{{$public}}/js/jquery.cookie.js"></script>
<script type="text/javascript">

$(function(){
   
    $("body").keydown(function(event) { 
        if(event.keyCode == "13" && $("#form button").attr('disabled')==undefined){
            $("#form button").click();
        }
    });

    $("#form button").click(function(){
        $this = $(this);
        $this.html('<img width="60" src="{{$public}}/fonts/three-dots.svg">');
        var jsonData = {};
        var mark = true;
        $("#form").find('input').each(function(){
            var msg = $("#form input[name='"+this.name+"']").attr('msg');
            if(this.value==''){
                $(".yzm-reload").trigger('click');
                $this.html('登 录').attr('disabled','disabled');
                setTimeout(function(){$this.removeAttr('disabled')},1000);
                layer.msg(msg,{icon:2,time:1200});
                mark = false;
                return mark;
            }
            jsonData[this.name] = this.value;
        });
        if(!mark){
            $this.html('登 录').attr('disabled','disabled');
            setTimeout(function(){$this.removeAttr('disabled')},1000);
            return false;
        }

        post('/login/doLogin',jsonData,function(res){
            
            if(res.retcode===1){
                layer.msg('登录成功',{icon:1,time:1000},function(){
                    $this.html('登 录');
                    window.location.href = '/welcome';
                });
                
            }else{
                $(".yzm-reload").trigger('click');
                layer.msg(res.msg,{icon:2,time:1200},function(){
                    $this.html('登 录');
                });
            }
        });
    });

})
</script>


</body></html>